#pragma once
#include <typescommon.h>
#define QUE_WITH_USR_INF 0
typedef uint32_t queOptType;
#define QUE_OPT_READ_SIZE 4
struct queOptStruct
{
#if QUE_WITH_USR_INF
    char usrInf[8];
#endif
    queOptType ridx[QUE_OPT_READ_SIZE];// read index
    queOptType widx;// write index
    queOptType bfSize;// buffer total size
    uint8_t bfSave[1];// buffer save ptr
};

int queOptInit(void *qptr, queOptType optSize);
queOptType queOptWrite(void *qptr, const uint8_t *iobuf, queOptType len);
queOptType queOptSize(void *qptr, uint8_t rdChnl);
queOptType queOptRead(void *qptr, uint8_t rdChnl, uint8_t *iobuf, queOptType len);
queOptType queOptRdFix(void *qptr, uint8_t rdChnl, uint8_t *iobuf, queOptType len);

#define queOptHeadSize (offsetof(struct queOptStruct, bfSave))
